// ignore_for_file: public_member_api_docs, sort_constructors_first
import 'package:flutter/material.dart';
import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart';

class HomeSwiper extends StatelessWidget {
  List adList = [];
  HomeSwiper(
    { Key? key, required List adList}
  ): super(key: key) {
    this.adList = adList;
  }
  @override
  Widget build(BuildContext context) {
    if(adList.isNotEmpty){
      return Swiper(
        itemBuilder: (BuildContext context, int index) {
          return  Image.network(
            adList?[index]['img'],
            // return  Image.asset(
            // 'images/flutter.jpg',
            fit: BoxFit.fill,
          );
        },
        indicatorLayout: PageIndicatorLayout.SCALE,
        autoplay: true,
        autoplayDelay: 2000,
        // itemCount: adList.length,
        itemCount: 3,
        pagination:  const SwiperPagination(),
        control:  const SwiperControl(),
        fade: 1.0,
        viewportFraction: 0.85,
      );
    }
    return Text("");
  }
}

